// pages/navigation/old/competition/detail/detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    content:{}
  },

  onLoad(optional){
    let that=this
     console.log('进入竞赛信息详情页面啦',optional)
     wx.cloud.database().collection('competiton_info')
     .doc(optional.id)
     .get()
     .then(res=>{
       var list=res.data
       list.date=this.getDateAndTime(list.date)
       that.setData({
         content:list
       })
     })
     .catch(res=>{
       console.log('获取竞赛内容失败',res);
     })
  
  },
  getDateAndTime:function(date) {
    var Y= date.getFullYear();
    var M = date.getMonth() + 1;
    M = M < 10 ? '0' + M : M;
    var D = date.getDate();
    D = D < 10 ? '0' + D : D;
    var hour = date.getHours();
    hour = hour < 10? '0' + hour : hour;
    var minute = date.getMinutes();
    minute = minute < 10? '0' + minute : minute;
    return Y + '年' + M + '月' + D + '日' + ' ' + hour + ':' + minute; 
  }

 
})